<HTML><HEAD>
<TITLE>netwib doc_html (version 5.39.0)</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H2><A HREF="../../index.html">main index</A></H2>
<H2><A HREF="../net.html">section index</A></H2><HR><BR>
<PRE>

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000"><B>/***************************************************************
 * An port range is of the form :                              *
 *                                   portinf     portsup       *
 *   123                      :        123         123         *
 *   123-124                  :        123         124         *
 *                                                             *
 * An <FONT COLOR="#000088">netwib_ports</FONT> is of the form :                            *
 *   port,port,portrange,portrange                             *
 *   all,!port,!portrange                                      *
 *                                                             *
 * Complete examples :                                         *
 *   123                                                       *
 *   123-125                                                   *
 *   1234,5678                                                 *
 *   1234,12356-12358                                          *
 *   all,!1234,!1244-1246                                      *
 ***************************************************************/</B></FONT>

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000"><B>/***************************************************************
 * Those functions ignores following error cases :             *
 *  - if we try to add a value already in the list             *
 *  - if we try to remove a value not in the list              *
 ***************************************************************/</B></FONT>

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef struct <FONT COLOR="#000088">netwib_ports</FONT> <FONT COLOR="#000088">netwib_ports</FONT>;
typedef const <FONT COLOR="#000088">netwib_ports</FONT> <FONT COLOR="#000088">netwib_constports</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_ports_init
   Description :
     Initialize a <FONT COLOR="#000088">netwib_ports</FONT> used to store port list.
   Input parameter(s) :
     inittype : if future added items will be sorted and/or unique
   Input/output parameter(s) :
   Output parameter(s) :
     **ppports : <FONT COLOR="#000088">netwib_ports</FONT> allocated and initialized
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
typedef enum {
  <FONT COLOR="#000044">NETWIB_PORTS_INITTYPE_SORTUNIQ</FONT> = 1, <FONT COLOR="#880000">/* sorted and unique */</FONT>
  <FONT COLOR="#000044">NETWIB_PORTS_INITTYPE_NOTSORTUNIQ</FONT> = 2, <FONT COLOR="#880000">/* not sorted and unique */</FONT>
  <FONT COLOR="#000044">NETWIB_PORTS_INITTYPE_NOTSORTNOTUNIQ</FONT> = 3 <FONT COLOR="#880000">/* not sorted and not
                                              unique (duplicates
                                              are not removed) */</FONT>
} <FONT COLOR="#000088">netwib_ports_inittype</FONT>;
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_init</B>(<FONT COLOR="#000088">netwib_ports_inittype</FONT> inittype,
                             <FONT COLOR="#000088">netwib_ports</FONT> **ppports);
<FONT COLOR="#008800">#define <B>netwib_ports_initdefault</B>(ppports) <B>netwib_ports_init</B>(<FONT COLOR="#000044">NETWIB_PORTS_INITTYPE_SORTUNIQ</FONT>,ppports)</FONT>

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_ports_close
   Description :
     Close a netwib_ports.
   Input parameter(s) :
   Input/output parameter(s) :
     **ppports : <FONT COLOR="#000088">netwib_ports</FONT> closed
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_close</B>(<FONT COLOR="#000088">netwib_ports</FONT> **ppports);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_ports_add_port
   Description :
     Add a port to the netwib_ports.
   Input parameter(s) :
     port : address to add
   Input/output parameter(s) :
     *pports : <FONT COLOR="#000088">netwib_ports</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_add_port</B>(<FONT COLOR="#000088">netwib_ports</FONT> *pports,
                                 <FONT COLOR="#000088">netwib_port</FONT> port);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_ports_add_portrange
   Description :
     Add a range of ports to the netwib_ports.
   Input parameter(s) :
     infport : inferior port
     support : superior port
   Input/output parameter(s) :
     *pports : <FONT COLOR="#000088">netwib_ports</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_add_portrange</B>(<FONT COLOR="#000088">netwib_ports</FONT> *pports,
                                      <FONT COLOR="#000088">netwib_port</FONT> infport,
                                      <FONT COLOR="#000088">netwib_port</FONT> support);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_ports_add_ports
   Description :
     Add a list of port to the netwib_ports.
   Input parameter(s) :
     *pportstoadd : <FONT COLOR="#000088">netwib_ports</FONT> to add
   Input/output parameter(s) :
     *pports : <FONT COLOR="#000088">netwib_ports</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_add_ports</B>(<FONT COLOR="#000088">netwib_ports</FONT> *pports,
                                  <FONT COLOR="#000088">netwib_constports</FONT> *pportstoadd);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_ports_add_buf
   Description :
     Update a <FONT COLOR="#000088">netwib_ports</FONT> with a string like "1234-1235".
   Input parameter(s) :
     *pbuf : buffer containing string
   Input/output parameter(s) :
     *pports : <FONT COLOR="#000088">netwib_ports</FONT> updated
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
   Note :
     If an error occurs during insertion, result will only
     contain partial data. It's developer's job to use a
     temporary <FONT COLOR="#000088">netwib_ports</FONT> to deal with such errors.
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_add_buf</B>(<FONT COLOR="#000088">netwib_ports</FONT> *pports,
                                <FONT COLOR="#000088">netwib_constbuf</FONT> *pbuf);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_ports_add_kbd
   Description :
     Update a <FONT COLOR="#000088">netwib_ports</FONT> with data entered through keyboard.
   Input parameter(s) :
     message : message to print before
     defaultlist : default list to use if user enters nothing
                   if NULL, there is no default
   Input/output parameter(s) :
     *pports : <FONT COLOR="#000088">netwib_ports</FONT> updated
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_add_kbd</B>(<FONT COLOR="#000088">netwib_ports</FONT> *pports,
                                <FONT COLOR="#000088">netwib_constbuf</FONT> *pmessage,
                                <FONT COLOR="#000088">netwib_constbuf</FONT> *pdefaultlist);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_ports_del_port
   Description :
     Del a port from the netwib_ports.
   Input parameter(s) :
     port : address to delete
   Input/output parameter(s) :
     *pports : <FONT COLOR="#000088">netwib_ports</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_del_port</B>(<FONT COLOR="#000088">netwib_ports</FONT> *pports,
                                 <FONT COLOR="#000088">netwib_port</FONT> port);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_ports_del_portrange
   Description :
     Del a range of ports to the netwib_ports.
   Input parameter(s) :
     infport : inferior port
     support : superior port
   Input/output parameter(s) :
     *pports : <FONT COLOR="#000088">netwib_ports</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_del_portrange</B>(<FONT COLOR="#000088">netwib_ports</FONT> *pports,
                                      <FONT COLOR="#000088">netwib_port</FONT> infport,
                                      <FONT COLOR="#000088">netwib_port</FONT> support);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_ports_del_ports
   Description :
     Remove a list of port to the netwib_ports.
   Input parameter(s) :
     *pportstodel : <FONT COLOR="#000088">netwib_ports</FONT> to remove
   Input/output parameter(s) :
     *pports : <FONT COLOR="#000088">netwib_ports</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_del_ports</B>(<FONT COLOR="#000088">netwib_ports</FONT> *pports,
                                  <FONT COLOR="#000088">netwib_constports</FONT> *pportstodel);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_ports_contains_xyz
   Description :
     Check if a <FONT COLOR="#000088">netwib_port</FONT> is in the list.
   Input parameter(s) :
     port : <FONT COLOR="#000088">netwib_port</FONT> to find
   Input/output parameter(s) :
     *pports : <FONT COLOR="#000088">netwib_ports</FONT> containing the list of addresses
   Output parameter(s) :
     *pyes : true if <FONT COLOR="#000088">netwib_port</FONT> is found
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_contains_port</B>(<FONT COLOR="#000088">netwib_constports</FONT> *pports,
                                      <FONT COLOR="#000088">netwib_port</FONT> port,
                                      <FONT COLOR="#000088">netwib_bool</FONT> *pyes);
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_ports_contains_portrange</B>(<FONT COLOR="#000088">netwib_constports</FONT> *pports,
                                           <FONT COLOR="#000088">netwib_port</FONT> infport,
                                           <FONT COLOR="#000088">netwib_port</FONT> support,
                                           <FONT COLOR="#000088">netwib_bool</FONT> *pyes);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_buf_append_ports
   Description :
     Append a string representing a netwib_ports.
   Input parameter(s) :
     *pports : <FONT COLOR="#000088">netwib_ports</FONT> to append
   Input/output parameter(s) :
     pbuf : buffer updated
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_buf_append_ports</B>(<FONT COLOR="#000088">netwib_constports</FONT> *pports,
                                   <FONT COLOR="#000088">netwib_buf</FONT> *pbuf);
</PRE><BR><BR><HR><BR>
<H2><A HREF="../../index.html">main index</A></H2>
<H2><A HREF="../net.html">section index</A></H2>
</BODY></HTML>
